<form id="J_loginCommand" action="/security/login" method="post">
	<div class="mod_dialog_login mod_dialog_common">
            <h2 class="title">登录KIMOJI</h2>
            <div class="loginbox">
                <h3 class="sectitle">使用注册邮箱登录</h3>
                <p class="item">
                    <span class="input-pos">
                        <i class="icon icon-t-email"></i>
                        <input type="text" name="loginName" id="J_userName" class="input input-email" rel="J_input_focus" />
                    </span>
                </p>
                <p class="item p_b_4">
                    <span class="input-pos">
                        <i class="icon icon-t-key"></i>
                        <input type="password" name="password" id="J_password" class="input input-pass" rel="J_input_focus"  />
                    </span>
                </p>
                 <p class="item clearfix">
	                	<label class="checkbox l p_t_8" for="J_rememberMe"><input type="checkbox" name="rememberMe" id="J_rememberMe"/>记住我 </label>
	                    <span class="r forget p_t_8"><a class="a_red_light" href="/register" data-target="#J_base_login_dialog" data-toggle="modal" data-width="750">注册新账号</a><a href="/help/forget_pass_account/" target="_blank" class="m_l_12 a_red_light">忘记密码？ </a></span>
		         </p>
		         <p class="btnbox">
		            <button type="button" onclick="releaseLogin();" class="btn btn-red btn-padding-long">登 录</button>
		         </p>
            </div>
        </div>
</form>        <script type="text/javascript">
        		var checkEmailReg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        	$(document).ready(function() {
        		
        	
				$("#J_articleIsHiddenChk").on("click",function(){
					if ($("#J_articleIsHiddenChk").is(":checked")){
						$("#J_articleIsHidden").val('1');
					}else{
						$("#J_articleIsHidden").val('0');
					}
				});
				
				//回车键进行搜索
				$(document).keydown(function(e){
					if(e.keyCode == 13) {
						releaseLogin();
					}
				});
			});
        	function releaseLogin(){
        		if($("#J_userName").val().length == 0){
        			 $("#J_userName").ace_widgets_validate(
                             {
                            	 errorText:"请输入用户名！",
                                 callback:function(){
                                     $("#J_userName").focus();
                                 }
                             }
                     );
        			return false;
        		}else if(!$("#J_userName").val().match(checkEmailReg)){
        			$("#J_userName").ace_widgets_validate(
                             {
                            	 errorText:"邮箱格式不正确！",
                                 callback:function(){
                                     $("#J_userName").focus();
                                 }
                             }
                     );
        			return false;
        		}else if($("#J_password").val() == 0){
        			$("#J_password").ace_widgets_validate(
                            {
                           	 errorText:"请输入密码！",
                                callback:function(){
                                    $("#J_password").focus();
                                }
                            }
                    );
        			return false;
        		}
        		var rememberMeStr = 'true';
        		if ($("#J_rememberMe").is(":checked")){
        			rememberMeStr = 'true';
        		}else{
        			rememberMeStr = 'false';
        		}
        		$.ajax({
		             type: "post",
		             url: "/security/login",
		             dataType: "json",
		             data:{loginName:$("#J_userName").val(),password:$("#J_password").val(),rememberMeStr:rememberMeStr},
		             async: true,
		             success: function(data){
		                 if(data.success){
				   			$("#J_baseIsLogin").val(1);
				   			$("#J_header_login_li").hide();
				   			$("#J_header_register_li").hide();
				   			$("#J_header_message_li").show();
				   			$("#J_header_user_photo_li").show();
				   			var userHeadImage = data.object.headImage;
				   			var userNickName = data.object.nickName;
				   			
				   			if(userHeadImage==null || userHeadImage=='')
				   			{
				   				userHeadImage='http://static.aceona.com/V3/assets/img/head_30.jpg';
				   			}else{
				   				userHeadImage=userHeadImage+"_1";
				   			}
				   			
				   			$("#J_user_header_image").attr("src",userHeadImage);
				   			$("#J_user_header_image").attr("alt",userNickName);
				 			$("#J_base_login_dialog").modal('hide'); 
				 			__AceLoginCallBack(); 
				   		}else{
				   		 	$("#J_userName").ace_widgets_validate({
		                           	 errorText:data.message,
		                                callback:function(){
		                                    $("#J_userName").focus();
		                                }
		                            });
		        			return false;
				   		}
		             },
		             error: function(){
		             }
		         });
			}
			
        </script>
